package com.suke.czx.modules.reward.entity;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.suke.czx.common.validate.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 应用模块名称: 奖惩
 * 代码描述: 奖惩实体
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/09/03 0:12
 */
@Data
@ApiModel(value = "奖惩管理")
@EqualsAndHashCode(callSuper = true)
public class Reward extends Model<Reward> {

    @ApiModelProperty(value = "奖惩id")
    @TableId(value = "reward_id", type = IdType.AUTO)
    @NotNull(groups = {RewardUpdateGroup.class}, message = "奖惩编码不能为空")
    public Long rewardId;

    @ApiModelProperty(value = "员工id")
    @NotNull(groups = {RewardSaveGroup.class, RewardUpdateGroup.class}, message = "员工编码不能为空")
    public Long staffId;

    @ApiModelProperty(value = "员工姓名")
    public String staffName;

    @ApiModelProperty(value = "事迹")
    @NotBlank(groups = {RewardSaveGroup.class, RewardUpdateGroup.class}, message = "事迹不能为空")
    public String deed;

    @ApiModelProperty(value = "类型:1 奖 2 惩")
    @NotNull(groups = {RewardSaveGroup.class, RewardUpdateGroup.class}, message = "类型不能为空")
    @EnumValue(groups = {RewardSaveGroup.class, RewardUpdateGroup.class}, intValues = {1, 2}, message = "奖惩类型只能是1,2")
    public Integer type;

    @TableField(exist = false)
    @ApiModelProperty(value = "类型名称")
    public String typeName;

    @ApiModelProperty(value = "处理结果")
    public String execResult;

    @ApiModelProperty(value = "执行日期")
    @NotNull(groups = {RewardSaveGroup.class, RewardUpdateGroup.class}, message = "执行日期不能为空")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    public Date execDate;

    @ApiModelProperty(value = "状态(0-不公开 1-公开)")
    @NotNull(groups = {RewardSaveGroup.class, RewardUpdateGroup.class}, message = "状态不能为空")
    @EnumValue(groups = {RewardSaveGroup.class, RewardUpdateGroup.class}, intValues = {0, 1}, message = "奖惩状态只能是0,1")
    public Integer status;

    @TableField(exist = false)
    @ApiModelProperty(value = "状态名称")
    public String statusName;

    @ApiModelProperty(value = "有效起始日期")
    @NotNull(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "有效起始日期不能为空")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    public Date validBeginDate;

    @ApiModelProperty(value = "有效截止日期")
    @NotNull(groups = {InfoSaveGroup.class, InfoUpdateGroup.class}, message = "有效截止日期不能为空")
    @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    public Date validEndDate;

    @TableField(exist = false)
    @ApiModelProperty(value = "部门")
    public String department;

    @TableField(exist = false)
    @ApiModelProperty(value = "岗位")
    public String jobs;

    @ApiModelProperty(value = "备注")
    public String note;

    @ApiModelProperty(value = "删除标记  0：删除   1：正常")
    public Integer del;

    @ApiModelProperty(value = "创建者id")
    public Long creator;

    @ApiModelProperty(value = "创建时间")
    public Date createTime;

    @ApiModelProperty(value = "更新者id")
    public Long updater;

    @ApiModelProperty(value = "更新时间")
    public Date updateTime;

}